package wk.demo.fragments.dialogFragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.luoye.bzijkplayer.R;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;


public class WkPlayerExtInfoFragment extends Fragment {

    public static WkPlayerExtInfoFragment getInstance(   ) {
        return new WkPlayerExtInfoFragment();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return  inflater.inflate(R.layout.fragment_wkcamera_pro, container, false);
    }


    private TextView infoShowTv ;
    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        infoShowTv = view.findViewById(R.id.infoShowTv) ;

    }



    private StringBuilder sb= new StringBuilder() ;
    private Map<String ,String> maps = new HashMap<>() ;
    public void updateRealTimeMsg(String key ,String msg2){
        maps.put(key ,msg2) ;

        if(infoShowTv== null){
            return;
        }

        sb .delete(0 ,sb.length()) ;
        Set<Map.Entry<String, String>> entrySet = maps.entrySet();
        for (Map.Entry<String, String> object : entrySet){
            String key1 = object.getKey();
            String value2 = object.getValue();
            sb.append("\r\n") .append(key1).append(" :  ").append(value2);
        }
        infoShowTv.setText(sb.toString());
    }


}
